clear all; close all; clc
 addpath('../LibForSerial/LibrarySLP','../LibForSerial/LibraryLeSage/');

%----------- Load shocks using LMN identification scheme ----------------%
  load('../Figure2_4_JLN/DataShocks/dataJMNupdated.mat'); 
 uF        = ehat_maxG(:,3); clearvars -except uF Uf datem
 
 %% Pictures for paper
[Years,M] = meshgrid(1961:2019, 1:1:12);
calM = datenum([Years(:), M(:), 28*ones(numel(Years),1)]); % The Serial Dates

ticks = datenum([(1965:6:2019)',12*ones(10,1), 28*ones(10,1) ]);
lim_x =[datenum(  1961,01,1), datenum(2019,12,31)];

LineWidth =  4.0;   

ushock = uF;
%-------------------------------------------------------------------------%
%% Figure 1 - Panel (a) and (b)
figure(1)
subplot(2,1,1)
 h_0 = line(calM(1:end),     Uf, 'linewidth',LineWidth);      title(['Time Series of Uf'])
  set(gca, 'XLim' , lim_x)
set(gca, 'XTick', ticks)
datetick('keepticks','keeplimits')
ylim([0 1.6])
box on
recessionplot
set(gca,'FontSize',32)

subplot(2,1,2)
h_1 = line(calM(1:end),     ushock, 'linewidth',LineWidth);      title(['Time Series of FIN uncertainty index shocks'])
hold on
      line(calM(1:end-2), 2*ones(size(calM(1:end-2),1),1),'color','k','linewidth',LineWidth);
      line(calM(1:end-2),-2*ones(size(calM(1:end-2),1),1),'color','k','linewidth',LineWidth);     
h_0  =line(calM(1:end-2), 0*ones(size(calM(1:end-2),1),1),'color','r','linewidth',LineWidth/2);
uistack(h_0, 'top')


  set(gca, 'XLim' , lim_x)
set(gca, 'XTick', ticks)
datetick('keepticks','keeplimits')
box on
recessionplot
set(gca,'FontSize',32)